package ve.ejb.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Memo
 */
@Entity
public class ScoreCardRelation implements Serializable {
    private static final long serialVersionUID = 1L;
    
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long idScoreCardRelation;

    @ManyToOne
    @JoinColumn(name="idScoreCard",nullable=false,updatable=true)
    private ScoreCard scoreCard;

    @ManyToOne
    @JoinColumn(name="idOtherScoreCard",nullable=false,updatable=true)
    private ScoreCard otherScoreCard;

    @Temporal(value = TemporalType.TIMESTAMP)
    private Date registerDate;

    private Double percentFactor;

    public Date getRegisterDate() {
        return registerDate;
    }

    public void setRegisterDate(Date registerDate) {
        this.registerDate = registerDate;
    }

    public Double getPercentFactor() {
        return percentFactor;
    }

    public void setPercentFactor(Double percentFactor) {
        this.percentFactor = percentFactor;
    }
    
    public Long getIdScoreCardRelation() {
        return idScoreCardRelation;
    }

    public ScoreCard getOtherScoreCard() {
        return otherScoreCard;
    }

    public void setOtherScoreCard(ScoreCard otherScoreCard) {
        this.otherScoreCard = otherScoreCard;
    }

    public ScoreCard getScoreCard() {
        return scoreCard;
    }

    public void setScoreCard(ScoreCard scoreCard) {
        this.scoreCard = scoreCard;
    }
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idScoreCardRelation != null ? idScoreCardRelation.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ScoreCardRelation)) {
            return false;
        }
        ScoreCardRelation other = (ScoreCardRelation) object;
        if ((this.idScoreCardRelation == null && other.idScoreCardRelation != null) || (this.idScoreCardRelation != null && !this.idScoreCardRelation.equals(other.idScoreCardRelation))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ve.ejb.entity.ScoreCardRelacion[id=" + idScoreCardRelation + "]";
    }

}
